#include <stdio.h>
#include<math.h>
int main()
{
    int bag, sum_price = 9999999;
    int n, num, price; // 总个数,每包个数,单价
    int T = 3;
    scanf("%d",&n);
    while (T--)
    {
        scanf("%d %d",  &num, &price);
        bag = ceil(n * 1.0 / num);
        if (bag * price < sum_price)
            sum_price = bag * price;
    }
    printf("%d", sum_price);

    return 0;
}